<?php
/**
 * Created by PhpStorm.
 * User: waw
 * Date: 2019/6/12
 * Time: 16:58
 */
if ($_SERVER["REQUEST_METHOD"]=="GET"){
    $result=array("msg"=>"对不起,不支持get请求","status"=>-1);
    print_r(json_encode($reuslt));
    return;
}

if(!(isset($_POST["uname"])&&isset($_POST["upwd"]))){
    $result=array("msg"=>"参数不合法","status"=>-2);
    print_r(json_encode($result));
    return;
}
include "DBhelper.php";

$uname=$_POST["uname"];
$upwd=$_POST["upwd"];
//$uemail=$_POST["uemail"];
//$utel=$_POST["utel"];
//$usex=$_POST["usex"];
//$uhobby=$_POST["uhobby"];
//$urealyname=$_POST["urealyname"];


//创建数据库连接
$conn=new mysqli("127.0.0.1","root","","yemaijiu","3306");
//设置字符集
mysqli_query($conn,"set names utf8");
//sql语句
$sql="INSERT INTO registor (`u_name`,`u_pwd`)VALUES('".$uname."','".$upwd."')";
//run
$resultData=sqlQuery($sql);
//判断得到的结果
if($resultData==1){
    $result=array("msg"=>"注册成功","status"=>1);
    print_r(json_encode($result));
}else{
    $result=array("msg"=>"注册失败","status"=>-3);
    print_r(json_encode($result));
}
